import { Link } from '@brillout/docpress'
import { CommunityNote } from '../../components'

<CommunityNote url="https://www.docker.com/" />

From the server's perspective, a Vike app is just a Node.js server, which means you can use any Node.js container image to run your Vike app.

If you use Docker also for development, and HMR doesn't work or you can't access your Vike app, then see <Link href="#development" />.

If you build your app inside your Docker container and run into out-of-memory errors, then see <Link href="#out-of-memory-errors" />.


## Development

You can use Docker also for development, see workarounds if you run into following issues:

### HMR doesn't work

If you are using Docker and <Link href="/glossary#hmr">HMR</Link> doesn't work:
- If you are under Windows and using [Docker with WSL](https://docs.docker.com/desktop/setup/install/windows-install/), then have a look at <Link href="/wsl" /> for how to enable HMR.
- You may need to configure Docker for [Vite's HMR websocket connection](https://vite.dev/config/server-options.html#server-hmr).

### Cannot access app

Vite's [`server.host` setting](https://vite.dev/config/server-options.html#server-host) should be truthy so that your app can be accessed from outside your Docker container, such as from the browser.

> Vike automatically changes the default value of `server.host` from `false` to `true` if it detects a Docker or Podman container environment.


## Out-of-memory errors

If you build your app inside your Docker container, you may stumble upon out-of-memory errors.

Check whether your Docker container has enough memory, and you may also need to set [Node.js' `--max-old-space-size`](https://nodejs.org/api/cli.html#--max-old-space-sizesize-in-megabytes).

```json
// package.json
{
  "scripts": {
    "build": "vike build"// [!code --]
    "// Increase Node.js memory size to 3GB": "",// [!code ++]
    "build": "NODE_OPTIONS=--max-old-space-size=3072 npm run build:vite",// [!code ++]
    "build:vite": "vike build"// [!code ++]
  }
}
```
